export LATEST=$(curl -L https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/latest)
kubectl apply -f https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-operator.yaml
kubectl apply -f https://storage.googleapis.com/kubevirt-prow/devel/nightly/release/kubevirt/kubevirt/${LATEST}/kubevirt-cr.yaml

kubectl -n kubevirt wait kv kubevirt --for condition=Available

# 打开软件虚拟化

# spec:
#     ...
#     configuration:
#     developerConfiguration:
#         useEmulation: true

# 部署虚拟机
kubectl apply -f https://kubevirt.io/labs/manifests/vm.yaml

# kubectl get vms
# kubectl get vms -o yaml testvm | grep -E 'running:.*|$'

# 启动虚拟机
# virtctl start testvm
# kubectl get vms
# 获取完整信息
# kubectl get vmis
# kubectl get vmis -o yaml testvm

# 访问虚拟机
# kubectl proxy --port=8080
# virtctl console testvm

# 停止虚拟机
# virtctl stop testvm

# 删除虚拟机
# kubectl delete vms testvm

kubectl get all -n kubevirt
